package com.ting.tadmin.controller;

import com.ting.tadmin.util.Alipay.AlipayUtil;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
@ResponseBody
public class IndexController{

    @RequestMapping("/")
    public String index(HttpServletResponse response, HttpServletRequest request) throws Exception {
        AlipayUtil alipayUtil = new AlipayUtil();
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("out_trade_no","20150320010101001");
        jsonObject.put("product_code","FAST_INSTANT_TRADE_PAY ");
        jsonObject.put("total_amount","88.88 ");
        jsonObject.put("subject","Iphone6 16G");
        jsonObject.put("body","Iphone6 16G");
        jsonObject.put("passback_params","merchantBizType%3d3C%26merchantBizNo%3d2016010101111");
        return alipayUtil.webpay(jsonObject);

    }
}
